package com.todo.sight.application.backend.controller;

import com.todo.common.common.entity.response.BizPageResponse;
import com.todo.common.common.entity.response.BizResponse;
import com.todo.sight.application.backend.service.SightInfoBackendService;
import com.todo.sight.application.iface.backend.SightInfoBackendIface;
import com.todo.sight.application.iface.backend.request.*;
import com.todo.sight.application.iface.backend.response.QuerySightInfoByConditionResp;
import com.todo.sight.application.iface.backend.response.SightInfoDetailResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author azhebuxing
 * @date 2024/5/16 13:57
 * @description
 */
@RestController
@RequestMapping("/bd/sight")
@Tag(name = "景点详情后台处理类", description = "景点详情后台处理类")

public class SightInfoBackendController implements SightInfoBackendIface {

    @Resource
    private SightInfoBackendService sightInfoBackendService;


    @Override
    @Operation(summary = "根据主键查询景点详情")
    @PostMapping("/querySightDetailById")
    public BizResponse<SightInfoDetailResp> querySightDetailById(@RequestBody QuerySightDetailByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightInfoBackendService.querySightDetailById(req);
    }

    @Override
    @Operation(summary = "多条件查询景点信息列表")
    @PostMapping("/querySightInfoByCondition")
    public BizPageResponse<QuerySightInfoByConditionResp> querySightInfoByCondition(@RequestBody QuerySightInfoByConditionReq req) {
        if (req == null) {
            return BizPageResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizPageResponse.paramError("参数错误");
        }
        return sightInfoBackendService.querySightInfoByCondition(req);
    }

    @Override
    @Operation(summary = "新增景点信息")
    @PostMapping("/insertSightInfo")
    public BizResponse<Boolean> insertSightDetail(@RequestBody InsertSightDetailReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightInfoBackendService.insertSightDetail(req);
    }


    @Override
    @Operation(summary = "根据主键更新景点信息")
    @PostMapping("/updateSightById")
    public BizResponse<Boolean> updateSightDetailById(@RequestBody UpdateSightDetailReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightInfoBackendService.updateSightDetailById(req);
    }

    @Override
    @Operation(summary = "根据主键删除景点信息")
    @PostMapping("/removeSightInfoById")
    public BizResponse<Boolean> removeSightInfoById(@RequestBody RemoveSightInfoByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightInfoBackendService.removeSightInfoById(req);
    }

    @Override
    @Operation(summary = "根据主键启禁用景点信息")
    @PostMapping("/enableSightInfoById")
    public BizResponse<Boolean> enableSightInfoById(@RequestBody EnableSightInfoByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return sightInfoBackendService.enableSightInfoById(req);
    }
}
